package com.suse.warmstill.controller;

import com.suse.warmstill.common.model.CallResult;
import com.suse.warmstill.common.model.ListPageModel;
import com.suse.warmstill.entity.TbStudent;
import com.suse.warmstill.service.StudentService;
import com.suse.warmstill.vo.ConditionVO;
import com.suse.warmstill.vo.StudentVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 黄靖
 * @author 2022-10-20 11:02
 * description:
 **/
@CrossOrigin
@Api(tags = "pc的学生管理")
@RestController
@RequestMapping("/warmstill/student")
public class PCStudentApi {

    @Autowired
    private StudentService studentService;


    @ApiOperation("查看学生所有的数据")
    @PostMapping("/list")
    public CallResult<ListPageModel<TbStudent>> listAll(@RequestBody @Validated ConditionVO conditionVO) {
        return studentService.lisAll(conditionVO);
    }

    @ApiOperation("插入一个学生数据")
    @PostMapping("/addOne")
    public CallResult<Void> insertOne(@RequestBody @Validated StudentVo studentVo) {
        studentService.insert(studentVo);

        return CallResult.success();
    }


}
